//
//  TMGMessageViewController.m
//  TMGold
//
//  Created by apple on 2018/3/22.
//  Copyright © 2018年 tangmu. All rights reserved.
//

#import "TMGMessageViewController.h"
#import "TMGMessageListViewController.h"
#import "KLMessageListViewController.h"
@interface TMGMessageViewController ()
@property(nonatomic, strong) STSegementButton     *segementButton;
@property(nonatomic, strong) UIScrollView     *scrollView;
@end

@implementation TMGMessageViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.title = @"通知消息";
    self.view.backgroundColor = [UIColor whiteColor];
    __weak typeof(self) weakSelf = self;
    self.segementButton = [[STSegementButton alloc] initWithFrame:CGRectMake(0, [TMUtils navgationBarBootom], UIScreenWidth, 49)
                                                         andTitle:@[@"系统通知",@"在线客服"] handle:^(STSegementButton *sender) {
                                                             if (weakSelf.segementButton.cureentIndex == 1) {
                                                                 [weakSelf.scrollView setContentOffset:CGPointMake(UIScreenWidth, 0) animated:YES];
                                                             }else{
                                                                                                                               [weakSelf.scrollView setContentOffset:CGPointMake(0, 0) animated:YES];
                                                             }
                                                            // [weakSelf.tableView reloadData];
                                                         }];
    self.segementButton.backgroundColor = [UIColor whiteColor];
    self.segementButton.lineSelectedColor = TM_orangeColor;
    self.segementButton.butTitleSelectedColor = TM_orangeColor;
    self.segementButton.butTitleColor = TM_secendTextColor;
    self.segementButton.lineColor = [UIColor whiteColor];
    self.segementButton.cureentIndex = 0;
    self.segementButton.autoMoveWithClic = YES;
    [self.view addSubview:self.segementButton];
    
    self.scrollView = [[UIScrollView alloc] initWithFrame:CGRectMake(0, self.segementButton.bottom, UIScreenWidth, [TMUtils tabBarTop] - self.segementButton.bottom + 49)];
    self.scrollView.scrollEnabled = NO;
    self.scrollView.backgroundColor = [UIColor whiteColor];
    self.scrollView.contentSize = CGSizeMake(2 * UIScreenWidth, 0);
    [self.view addSubview:self.scrollView];
    
    TMGMessageListViewController * vc =  [TMGMessageListViewController new];
    [self addChildViewController:vc];
    UIView * view = vc.view;
    [self.scrollView addSubview:view];
    
    KLMessageListViewController * chatVC = [KLMessageListViewController new];
    chatVC.view.backgroundColor = TM_backgroundColor;
    chatVC.tableView.backgroundColor =  TM_backgroundColor;
    [self addChildViewController:chatVC];
    UIView * listView = chatVC.view;
    listView.backgroundColor = TM_orangeColor;
    listView.left= UIScreenWidth;
    [self.scrollView addSubview:listView];
    // Do any additional setup after loading the view.
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
